home *** CD-ROM | disk | FTP | other *** search
- zlib for atari ST
- -----------------
-
- note: if you do not have or use compress, this is probably not for you...
-
- this was posted to alt.sources circa nov 1990. i thought it would be
- useful so i ported it to TOS. it provides a stdio-like stream interface
- for reading compressed files. the args are similar to "normal" stdio. i
- ported it to TOS (Alcyon). it should work fine with sozobon, gcc, minix(?)
- and whatever, though i have not tested it with these.
-
- what it does: it provides a READ ONLY stream interface for compressed
- files, i.e. those compressed which unix compress (of which there is, of
- course, a TOS version). up to 16-bit compress is supported. to write
- compressed files, you can do something like:
-
- write_to_tmp_file (buf, tmpfilename);
- sprintf (cmd, "compress %s", tmpfilename);
- system (cmd);
-
- no support for "zfputc" or "zfputs" or "zprintf" is provided here. still,
- this is very useful indeed. currently it might be limited to compressed
- text files, at least with alcyon, though that will probably not be the
- case with gcc. i also runs fine under unix.
-
- included are:
-
- zfopen open a compressed (or normal) file
- zfclose closes compressed stream
- zfgetc get a single char from stream (does cr-lf translation)
- zfgets get a single line from stream
- zfeof test for EOF on stream
- zfilter for working with stdin
-
- note that you MUST zfclose a file to free memory. exit/_exit will not do
- this for you (obviously).
-
- i have not tried working with zfilter for reading stdin. this is really
- compiler/library/shell dependent since stdin must be read binary (the cr-lf
- issue). my environment does not permit this (gulam), at least not to my
- knowledge.
-
- zfopen will currently only open compressed ascii files (DOS, TOS). zfgetc
- will check for a cr-lf and return only the linefeed. if the file is compressed,
- it normally has a .z extension. if not, zfopen will check to see if the file
- is in fact compressed. if not, zfgetc/zfgets will still read it using fgetc,
- though the read will be slower than using fgetc directly.
-
- i have not tested zfgets but it looks ok, more or less. see original author's
- comments in the src.
-
- this library will handle 16-bit compressed files. it has been tested with
- 16-bit compress 4.3 for the atari ST:
-
- compress 4.3 88/12/26 08:00:00 don
- Options: Unix MAXBITS = 16
-
- makefile will build a library ("make initial" first time, then "make all"
- during development) and a version of zcat for testing ("make test"). to
- run the tests, do "make runtest" which uses file "ascii" for the tests.
- you will need compress(1) and cmp(1) to test.
-
- i have included an executable for zcat (the test program). see makefile
- for how to run it. all included in this post are alcyon-compatible libraries
- and aln index file (zlib.ndx). zlib.out is log of atari doindex command for
- aln random libraries.
-
- enjoy...
-
- -bill rosenkranz
- rosenkra%c1yankee@convex.com
-
-